package light.head.model.inv;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;

/**
 * 退货信息
 * @author yy
 *
 */
@Entity
@Table
public class InvReturnInfo implements Serializable{
	private static final long serialVersionUID = 4075251826608759408L;
	private Integer code;					// 流水号
	private Integer oc;						// 机构编号
	private String dn;						// 单据编号
	private Byte type;						// 退货类型(1.进货退货 2.销货退货，3.零售退货)
	private Double total;					// 退款额
	private Integer cu;						// 创建人
	private Date ct;						// 创建时间
	private Boolean deleted = false;		// 是否删除
	private String remark;					// 退货详情
	private Integer bc;						// 来往商编号
	private String customer ;				// 客户名称
	private String tel;						// 手机号码
	private Integer smc;					// 销售员
	
	private String sname;					// 销售员名称
	private String on;
	private String cn;
	private String bname;				// 来往商名称
	private List<InvReturnItem> itemList;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public String getDn() {
		return dn;
	}
	@Column
	public Integer getBc() {
		return bc;
	}
	@Column
	public Byte getType() {
		return type;
	}
	@Column(updatable = false, nullable = false)
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Double getTotal() {
		return total;
	}
	@Column
	public String getCustomer() {
		return customer;
	}
	@Column
	public String getTel() {
		return tel;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	@Column
	public Integer getSmc() {
		return smc;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = smc)")
	public String getSname() {
		return sname;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT c.name FROM InvBusiness c WHERE c.code = bc)")
	public String getBname() {
		return bname;
	}
	@Transient
	public List<InvReturnItem> getItemList() {
		return itemList;
	}
	
	
	
	
	
	
	
	
	
	
	public void setSmc(Integer smc) {
		this.smc = smc;
	}
	public void setSname(String sname) {
		this.sname = sname;
	}
	public void setCustomer(String customer) {
		this.customer = customer;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public void setTotal(Double total) {
		this.total = total;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setItemList(List<InvReturnItem> itemList) {
		this.itemList = itemList;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDn(String dn) {
		this.dn = dn;
	}
	public void setType(Byte type) {
		this.type = type;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setBc(Integer bc) {
		this.bc = bc;
	}
	public void setBname(String bname) {
		this.bname = bname;
	}
	
	
}
